<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
</head>
<body>
<button id="button_01">GET</button>
<button id="button_02">POST</button>
<button id="button_03">AJAX</button>
<script>
  $("#button_01").click(() => {
      $.get("http://localhost:8000/jquery", {a:100, b:200, c:300}, (response) => {
          console.log(response)
      }, "json")
  })

  $("#button_02").click(() => {
      $.post("http://localhost:8000/jquery", {a:100, b:200, c:300}, (response) => {
          console.log(response)
      })
  })

  $("#button_03").click(() => {
      $.ajax({
          // url
          url: "http://localhost:8000/jquery",

          // 请求参数
          data: {a:100, b:200, c:300},

          // 请求类型
          type: "GET",

          // 数据类型
          dataType: "json",

          // 超时时间
          timeout: 2000,

          // 请求头
          headers: {
              a:100,
              b:200,
          },

          // 请求成功的回调
          success: (response) => {
              console.log(response)
          },

          // 请求失败的回调
          error: () => {
              console.log("请求失败!")
          }
      })
  })

</script>
</body>
</html>